const { SuccessSend } = require("../../utils/response");
// session校验
const session = (req, res, next) => {
    if (!req.session.user) {
        return SuccessSend(res, {
            code: -1,
            success: false,
            message: "用户未登录"
        });
    }
    if (!req.session.user.role == "user") {
        return SuccessSend(res, {
            code: -1,
            success: false,
            message: "权限不足"
        });
    }
    next();
};

module.exports = { session };
